/*A Pythagorean triplet is a set of three natural numbers, a  b  c, for which,

a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.*/
public class EulerProblem9 {
    public static void main(String []arg){
//        int a=998;
//        int b=1;
//        int c=1;
//        while (a +b+c==1000){
        for(int a=1;a<=1000;a++){
            for(int b =a+1;b<=1000-a;b++){
                for(int c=1+b;c<=1000-a-b;c++){
                   if((a*a +b*b)==c*c){
                       if(a +b+c==1000){
                       System.out.println(a+" "+ b+" "+  c);
                        System.out.println(a*b*c);
                       }
                    }
                }
            }
        }
//            if((a*a +b*b)==c*c){
//                System.out.print(a*b*c);
//            }
//        }

    }
}
